<?php
require BASEPATH . 'plugins/doctrine/lib/Doctrine/Common/ClassLoader.php';

$classLoader = new \Doctrine\Common\ClassLoader('Doctrine', BASEPATH . 'plugins/doctrine/lib');
$classLoader->register();

$classLoader = new \Doctrine\Common\ClassLoader('Entities', APPPATH . 'models');
$classLoader->register();

$classLoader = new \Doctrine\Common\ClassLoader('Proxies', BASEPATH . '/Proxies');
$classLoader->register();

function getEntityManager($connectionOptions, $config) {
    return \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
}